import Link from 'next/link'
import React from 'react'
import Layout from '@/components/layout'
interface Props {
  fetchData: {
    code: number
    msg: string
  }
}
export default function FirstPage({ fetchData }: Props) {
  return (
    <>
      <div>Firstpage</div>
      <div>{fetchData.msg}</div>
      <Link href={'/'}>回首页</Link>
    </>
  )
}
export async function getStaticProps() {
  const fetch = () => {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve({
          msg: '成功',
          code: 200,
        })
      }, 2000)
    })
  }

  const fetchData = await fetch()
  return {
    props: {
      fetchData,
    },
  }
}
